<?php

namespace App\Http\Requests\ApiV2;

class PartsRequest extends BaseRequest
{
    public function rules()
    {
        return [
            'partsCode' => 'required',
            'partsName' => 'required',
            'brand' => 'required',
            'model' => 'required',
            'vendorId' => 'required',
            'categoryId' => 'required',
            'source' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'partsCode.required' => __('配件编码必须有'),
            'partsName.required' => __('配件名称必须有'),
            'brand.required' => __('品牌必须有'),
            'model.required' => __('规格型号必须有'),
            'vendorId.required' => __('供应商必须有'),
            'categoryId.required' => __('类别必须有'),
            'source.required' => __('配件来源必须有'),
        ];
    }

    public function filldata()
    {
        return [
            'partsCode' => $this->input('partsCode'),
            'partsName' => $this->input('partsName'),
            'brand' => $this->input('brand'),
            'model' => $this->input('model'),
            'vendorId' => $this->input('vendorId'),
            'categoryId' => $this->input('categoryId'),
            'source' => $this->input('source'),
            'remark' => $this->input('remark'),
        ];
    }
}
